#include "XScene.h"

XScene::XScene(){

}

XScene::~XScene(){

}



string XScene::ToString(){
	return "XMod::XScene";
}


void XScene::AddNodes(XNode* n_node){
	lst_nodes.insert(lst_nodes.end(), n_node);
}

void XScene::DeleteNode(){

}

void XScene::ClearScene(){
	for each (XNode* ix_node in lst_nodes)
	{
		//try to release the node in scene
		SAFE_RELEASE(ix_node);
	}
	lst_nodes.clear();
}

void XScene::UpdateNodes(){
	if (m_mainCamera != NULL){
		m_mainCamera->OpenEyes();
		m_mainCamera->Update();
	}
	for each (XNode* ix_node in lst_nodes)
	{
		ix_node->UpdateSceneGraph(false);
	}
}

void XScene::RenderNodes(){
	for each (XNode* ix_node in lst_nodes)
	{
		ix_node->Render();
	}
}

void XScene::SetMainCamera(XCamera* camera){
	if (camera!=NULL)
		m_mainCamera = camera;
}